﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Assignment4
{
    class DecisionNode
    {
        private int nodeLevel;

        public int NodeLevel
        {
            get { return nodeLevel; }
            set { nodeLevel = value; }
        }
        private string testValue;

        public string TestValue
        {
            get { return testValue; }
            set { testValue = value; }
        }

        private string value;

        public string Value
        {
            get { return this.value; }
            set { this.value = value; }
        }

        private bool isLeaf;

        public bool IsLeaf
        {
            get { return isLeaf; }
            set { isLeaf = value; }
        }


        private Dictionary<string, DecisionNode> childNodes;

        internal Dictionary<string, DecisionNode> ChildNodes
        {
            get { return childNodes; }
        }

        public DecisionNode(int nodeLevel)
        {
            this.nodeLevel = nodeLevel;
            childNodes = new Dictionary<string, DecisionNode>();
            isLeaf = false;
        }

        public void setChildNodes(string attributeValue, DecisionNode child)
        {
            try
            {
                childNodes.Add(attributeValue, child);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Child node with key {0} already existed", attributeValue);
                Console.ReadLine();
                Environment.Exit(0);
            }
        }
    }
}
